package com.cocos.game;

//方法调用枚举类
public enum FuntionEnum {
    //JS 调用 Java 登录
    LOGIN("Login"),

    //Java 调用 JS 登录结果返回
    LOGIN_BACK("onLogin"),

    //JS 调用 Java 初始化参数
    INIT("Init"),

    //JS 调用 Java 获取玩家当前剩余时长
    REMAINING_TIME("RemainingTime"),

    //JS 调用 Java 获取玩家当前剩余时长返回
    REMAINING_TIME_BACK("onRemainingTime"),

    PLAY_AD("Play_AD");

    private final String name;

    FuntionEnum(String roleName) {
        this.name = roleName;
    }

    public String getName() {
        return name;
    }

    public static FuntionEnum fromString(String roleName) {
        for (FuntionEnum role : values()) {
            if (role.name.equals(roleName)) {
                return role;
            }
        }
        throw new IllegalArgumentException("Invalid role name: " + roleName);
    }
}
